<?php

/**
 * Users form base class.
 *
 * @method Users getObject() Returns the current form's model object
 *
 * @package    sf_sandbox
 * @subpackage form
 * @author     Your name here
 * @version    SVN: $Id: sfDoctrineFormGeneratedTemplate.php 29553 2010-05-20 14:33:00Z Kris.Wallsmith $
 */
abstract class BaseUsersForm extends BaseFormDoctrine
{
  public function setup()
  {
    $this->setWidgets(array(
      'id'               => new sfWidgetFormInputHidden(),
      'civilite'         => new sfWidgetFormChoice(array('choices' => array('M' => 'M', 'Mme' => 'Mme', 'Melle' => 'Melle'))),
      'nom'              => new sfWidgetFormInputText(),
      'prenom'           => new sfWidgetFormInputText(),
      'email'            => new sfWidgetFormInputText(),
      'mdp'              => new sfWidgetFormInputText(),
      'inscription'      => new sfWidgetFormDateTime(),
      'newsletter'       => new sfWidgetFormInputText(),
      'login'            => new sfWidgetFormInputText(),
      'type'             => new sfWidgetFormChoice(array('choices' => array('Candidat' => 'Candidat', 'Modérateur' => 'Modérateur', 'Admin' => 'Admin'))),
      'etat'             => new sfWidgetFormInputText(),
      'ip'               => new sfWidgetFormInputText(),
      'date_inscription' => new sfWidgetFormDateTime(),
      'date_connexion'   => new sfWidgetFormDateTime(),
    ));

    $this->setValidators(array(
      'id'               => new sfValidatorChoice(array('choices' => array($this->getObject()->get('id')), 'empty_value' => $this->getObject()->get('id'), 'required' => false)),
      'civilite'         => new sfValidatorChoice(array('choices' => array(0 => 'M', 1 => 'Mme', 2 => 'Melle'))),
      'nom'              => new sfValidatorString(array('max_length' => 100)),
      'prenom'           => new sfValidatorString(array('max_length' => 100)),
      'email'            => new sfValidatorString(array('max_length' => 150)),
      'mdp'              => new sfValidatorString(array('max_length' => 100)),
      'inscription'      => new sfValidatorDateTime(),
      'newsletter'       => new sfValidatorInteger(array('required' => false)),
      'login'            => new sfValidatorString(array('max_length' => 50)),
      'type'             => new sfValidatorChoice(array('choices' => array(0 => 'Candidat', 1 => 'Modérateur', 2 => 'Admin'))),
      'etat'             => new sfValidatorInteger(array('required' => false)),
      'ip'               => new sfValidatorString(array('max_length' => 15)),
      'date_inscription' => new sfValidatorDateTime(),
      'date_connexion'   => new sfValidatorDateTime(),
    ));

    $this->widgetSchema->setNameFormat('users[%s]');

    $this->errorSchema = new sfValidatorErrorSchema($this->validatorSchema);

    $this->setupInheritance();

    parent::setup();
  }

  public function getModelName()
  {
    return 'Users';
  }

}
